package wiki.xsx.jg.core;

/**
 * 字段对象
 */
public class Field {
    // 字段名称
    private String name;
    // 字段的数据类型
    private String type;
    // 字段的Java类型
    private Class<?> javaType;
    // 字段总长度
    private Integer lengh;
    // 字段的小数位数
    private Integer scale;
    // 字段的默认值
    private String defaultValue;
    // 是否为自增(适用于MySQL)
    private boolean isAutoIncrement;
    // 是否不为NULL
    private boolean isNotNull;
    // 是否为主键
    private boolean isPrimaryKey;
    // 字段的注释
    private String comment;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Class<?> getJavaType() {
        return javaType;
    }

    public void setJavaType(Class<?> javaType) {
        this.javaType = javaType;
    }

    public Integer getLengh() {
        return lengh;
    }

    public void setLengh(Integer lengh) {
        this.lengh = lengh;
    }

    public Integer getScale() {
        return scale;
    }

    public void setScale(Integer scale) {
        this.scale = scale;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public Boolean getIsAutoIncrement() {
        return isAutoIncrement;
    }

    public void setIsAutoIncrement(boolean isAutoIncrement) {
        this.isAutoIncrement = isAutoIncrement;
    }

    public boolean getIsNotNull() {
        return isNotNull;
    }

    public void setIsNotNull(boolean isNotNull) {
        this.isNotNull = isNotNull;
    }

    public boolean getIsPrimaryKey() {
        return isPrimaryKey;
    }

    public void setIsPrimaryKey(boolean isPrimaryKey) {
        this.isPrimaryKey = isPrimaryKey;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Override
    public String toString() {
        return "Field{" +
                "name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", javaType=" + javaType +
                ", lengh=" + lengh +
                ", scale=" + scale +
                ", defaultValue='" + defaultValue + '\'' +
                ", isAutoIncrement=" + isAutoIncrement +
                ", isNotNull=" + isNotNull +
                ", isPrimaryKey=" + isPrimaryKey +
                ", comment='" + comment + '\'' +
                '}';
    }
}
